package Test1;

import java.util.Scanner;

class Thread2 extends Thread{
   int number;
    int ans =1;
    public Thread2(int number){
        this.number = number;

    }
    @Override
    public void run() {

        while(number!=1){
            ans *= number;
            number--;
        }
    }

    public void back(){
        System.out.print(ans+" ");
    }
}
public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("please input 5 numbers:[1-10]  ");
       String s = sc.next();
       String [] s1 = s.split(",");
       String s2="";
       for(String i:s1){
           s2+=i+" ";
       }

       int [] nums = new int[5];
       for(int i=0;i<nums.length;i++){
           nums[i]= Integer.parseInt(s1[i]);
       }
        Thread2 t1 = new Thread2(nums[0]);
        Thread2 t2 = new Thread2(nums[1]);
        Thread2 t3 = new Thread2(nums[2]);
        Thread2 t4 = new Thread2(nums[3]);
        Thread2 t5 = new Thread2(nums[4]);
        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();

        System.out.print("The factorials for "+s2+" are  ");
        t1.back();
        t2.back();
        t3.back();
        t4.back();
        t5.back();

    }
}